/*
 *  mih_sap.h
 *  MIHF
 *
 *  Created by injae song on 11. 3. 4..
 *  Copyright 2011 KyungHee Univ. All rights reserved.
 *
 */

#ifndef MIH_SAP_H
#define MIH_SAP_H

#include "mihf.h"
#include "mih_user.h"
#include "mih_message.h"
#include "mih_dispatcher.h"
#include "debug.h"

/*****************************************************************************
 *                                                                            *
 *  ------------------------------ mih_sap.h ------------------------------  *
 *                                                                            *
 *****************************************************************************/

#define MIH_USER_PORT 3285  /* port for MIH_USER */

#define MAX_LISTEN 10     /* how many pending connections queue will hold */

void mih_sap_init(mihf* mih);
void mih_sap_connection_accept(int sockfd, short event , void *ev);
void mih_sap_read_handler(struct bufferevent *bev, void *arg);
void mih_sap_write_handler(struct bufferevent *bev, void *arg);
void mih_sap_error_handler(struct bufferevent *bev, short what, void *arg);
void mih_sap_send_message(mih_message *msg, mih_user *user);

#endif